package files_controller_with_factory;
import java.io.*;
import org.apache.log4j.Logger;

public class HelpCommandExecutor implements ICommandExecutor{
	
	private static final Logger cont_log = Logger.getLogger("control");
	
	public void execute(String string){			
		try{
			 	Choise();		
			}catch(IOException e){
				cont_log.error("Error of input/output", e);
			}
		}
		
	private void Choise() throws java.io.IOException{		
		//byte[] b = new byte[10];
		//char choise;
		int choise;
		do{
			System.out.println("Information about: ");
			String[] Menu = {" 1 - DirCommandExecutor ", " 2 - TreeCommandExecutor ", " 3 - FindCommandExecutor ", 
					" 4 - MkdirCommandExecutor ", " 5 - CopyCommandExecutor ", " 6 - DeleteCommandExecutor", 
					" 7 - MoveCommandExecutor ", " 8 - CdCommandExecutor ", " 9 - ExitCommandExecutor ", " 10 - close menu"};
			for(String x : Menu){
				System.out.println(x);
			}
			System.out.println("Choose interesting item: ");
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			choise = Integer.parseInt(br.readLine());
			
			//System.in.read(b);
			//choise = (char) b[0];
			
		} while(choise<1 || choise>10);
		
		
		switch(choise){
			case(1):
				System.out.println("dir[space]path[e.g. A:\\example]");
				break;
			case(2):
				System.out.println("tree[space]path[e.g. A:\\example]");
				break;
			case(3):
				System.out.println("find[space]path[e.g. A:\\example][space]word");
				break;
			case(4):
				System.out.println("mkdir[space]path[e.g. A:\\example][space]word");
				break;
			case(5):
				System.out.println("copy[space]source_path[e.g. A:\\example1][space]destin_path[e.g. B:\\example2]"
						+ "[space]file.txt {Note: A:\\example1 should contain file.txt}");
				break;
			case(6):
				System.out.println("delete[space]path[e.g. A:\\example]");
				break;
			case(7):
				System.out.println("move[space]source_path[e.g. A:\\example][space]destin_path[e.g. B:\\example2]"
						+ "[space]file.txt {Note: A:\\example1 should contain file.txt}");
				break;	
			case(8):
				System.out.println("cd[space]current_working_path[e.g. C:]");
				break;
			case(9):
				System.out.println("exit");
				break;
			case(10):
				System.out.println();
				break;
			}		
		}
	
	private static HelpCommandExecutor instance;
	private HelpCommandExecutor(){		
	}
	public static ICommandExecutor getInstance(){
		if(instance==null){
			instance = new HelpCommandExecutor();
		}
		return instance;
	}
}
